#!/usr/bin/python3
# -*- coding:utf-8 -*-
""""
   @Author: 即将拥有人鱼线的yjw
   @Time: 2024/6/27 14:00
   @File: dataGather.py
   @desc:库对库采集
"""
from CommonScripts.blade import python_exec_sql
from BladeFerm.Lib.Common import logger

def createDataSrc(interfaceNo,env=None):
    '''
    修改接口信息，接口启动
    '''

    selectSQL = f"select *  from hspbs.sys_interface_info where interface_no = '{interfaceNo}' "
    result = python_exec_sql(selectSQL, env=env)
    if result:
        sql = f"update hspbs.sys_interface_info set is_enabled = '0' where interface_no = '{interfaceNo}'"
        python_exec_sql(sql, env=env)   #启动接口号
    else:
        logger.info(f"接口{interfaceNo}不存在，请检查接口号输入是否正确！")


    # #接口号更新完重启pbs
    # restart('', 'pbs-server', env=env)


if __name__ == '__main__':
    env = 'mysql'
    interfaceNo = '2101'
    createDataSrc(interfaceNo,env)


